

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title></title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  <link rel="stylesheet" href="/layuiadmin/layui/css/layui.css" media="all">
  <link rel="stylesheet" href="/layuiadmin/style/admin.css" media="all">
  <script src="/layuiadmin/echarts.min.js"></script>
</head>
<body>
  <div id="main" style="width: 600px;height:400px;float: left"></div>
  <div id="main2" style="width: 400px;height:400px;float: left"></div>
  <div id="main3" style="width: 600px;height:400px;float: left"></div>
  <script type="text/javascript">
    // 基于准备好的dom，初始化echarts实例
    var myChart = echarts.init(document.getElementById('main'));
    var myChart3 = echarts.init(document.getElementById('main3'));
    // 指定图表的配置项和数据
    var option = {
      title: {
        text: '材料成本分析'
      },
      tooltip: {},
      legend: {
        data:['材料成本']
      },
      xAxis: {
        data: ["材料1","材料2","材料3","材料4","材料5","材料6"]
      },
      yAxis: {},
      series: [{
        name: '材料成本',
        type: 'bar',
        data: [5, 20, 36, 10, 10, 20]
      }]
    };
    // 使用刚指定的配置项和数据显示图表。
    myChart.setOption(option);
    echarts.init(document.getElementById('main2')).setOption({
      series: {
        type: 'pie',
        data: [
          {name: '材料1', value: 1212},
          {name: '材料2', value: 2323},
          {name: '材料3', value: 1919}
        ]
      }
    });
    var option2 = {
      title: {
        text: '材料成本分析'
      },
      tooltip: {
        trigger: 'axis'
      },
      legend: {
        data: ['材料1', '材料2', '材料3', '材料4', '材料5']
      },
      grid: {
        left: '3%',
        right: '4%',
        bottom: '3%',
        containLabel: true
      },
      toolbox: {
        feature: {
          saveAsImage: {}
        }
      },
      xAxis: {
        type: 'category',
        boundaryGap: false,
        data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日']
      },
      yAxis: {
        type: 'value'
      },
      series: [
        {
          name: '材料1',
          type: 'line',
          stack: '总量',
          data: [120, 132, 101, 134, 90, 230, 210]
        },
        {
          name: '材料2',
          type: 'line',
          stack: '总量',
          data: [220, 182, 1000, 600, 290, 330, 310]
        },
        {
          name: '材料3',
          type: 'line',
          stack: '总量',
          data: [150, 232, 201, 154, 450, 330, 410]
        },
        {
          name: '材料4',
          type: 'line',
          stack: '总量',
          data: [320, 332, 301, 334, 390, 330, 320]
        },
        {
          name: '材料5',
          type: 'line',
          stack: '总量',
          data: [820, 932, 901, 934, 1290, 1330, 1320]
        }
      ]
    };
    myChart3.setOption(option2);
  </script>

 <script src="/layuiadmin/layui/layui.js"></script>
</body>
</html>

